let form = layui.form
let layer = layui.layer
$(function () {
  // 粒子线条背景
  $(document).ready(function () {
    $('.layui-container').particleground({
      dotColor: '#7ec7fd',
      lineColor: '#7ec7fd'
    })
  })

  // 登录操作
  $('form').on('submit', function (e) {
    e.preventDefault();
    // 收集数据
    //let data = $(this).serialize();
    let data = form.val("mylogin");
    console.log(data);
    $.ajax({
      url: 'api/login',
      type: 'POST',
      data: data,
      success: function (res) {
        layer.msg(res.message);
        if (res.status == 0) {
          location.href = './index.html';
          localStorage.setItem('mytoken', res.token)
        }
      }
    })
  })

})